package utilities;
import java.util.*;
import org.w3c.dom.*;

public class KeyActions {

	String key;
	Map filterActions = new TreeMap();
	
	public KeyActions(String key, NodeList actions)
	{	
		this.key=key;		
		processActions(actions);				
	}
	
	public Collection getActions()
	{
		return filterActions.values();
	}
	
 	private void processActions(NodeList actions)
	{
		  String pe = null;
		  String pa = null;
		  String pr = null;
		  String order = null;
		  for (int s = 0; s < actions.getLength(); s++) {
				
			  Node fstNode2 = actions.item(s);
			  Element fstElmnt2 = (Element) fstNode2;
			  
			  			  
			  NodeList nodeLst2 = fstElmnt2.getElementsByTagName("engine");
			  for (int s2 = 0; s2 < nodeLst2.getLength(); s2++) {
				  pe = nodeLst2.item(s2).getChildNodes().item(0).getNodeValue();
				    break;
			  } 			  
			  nodeLst2 = fstElmnt2.getElementsByTagName("name");
			  for (int s2 = 0; s2 < nodeLst2.getLength(); s2++) {
				  pa = nodeLst2.item(s2).getChildNodes().item(0).getNodeValue();
				    break;
			  } 			  
			  nodeLst2 = fstElmnt2.getElementsByTagName("resource");
			  for (int s2 = 0; s2 < nodeLst2.getLength(); s2++) {
				  pr = nodeLst2.item(s2).getChildNodes().item(0).getNodeValue();
				    break;
			  } 			  			  
			  nodeLst2 = fstElmnt2.getElementsByTagName("order");
			  for (int s2 = 0; s2 < nodeLst2.getLength(); s2++) {
				  order = nodeLst2.item(s2).getChildNodes().item(0).getNodeValue();
				    break;
			  } 			  
			  ProcFilter pf = new ProcFilter(this.key,pe,pa,pr);			  
			  filterActions.put(Integer.valueOf(order),pf);
		  } 
					
	}
	
	
}
